<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Index</title>
<script src="jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="jquery-ext.js" type="text/javascript"></script>
</head>
<body>

	<a href="login">Log In.</a> | 
	<a href="admin">user Center</a> |
	<a href="admin/product">Product</a> |
	<a href="init/db">Init Database</a> |
	<a href="init/index">Init Index</a> |
	<hr>
	Become our memeber :
	<br />
	LoginName(Mail)<input type="text" id="loginName" name="loginName" value="hsia@163.com"><button id="checkBtn">check</button><br/>
	Password<input type="text" id="password" name="password" value="123456"><br/>
	<button id="registerBtn">Register</button>
	<script>
	function testit(data){
		alert(0);
	}
		 $("#checkBtn").click(function(){
			 var val=$("#loginName").val().trim();
			 if(val==""){
				 alert('need input user name');
				 return;
			 }
			
			  /* $.get("user/check?loginName="+$("#loginName").val()+"&callback=testit", function(result){
			   alert("User Exists?"+result.errCode) 
			  }); */
			   $.ajax({
                   url: "user/check.json?loginName="+$("#loginName").val()+"&callback=testit",
                   dataType: 'jsonp',
                   'contentType': 'application/json',
                   success: function(result){
                       alert(result)
                   }
               });
			}); 
	</script>
		<script>
		 $("#registerBtn").click(function(){
			 var val=$("#loginName").val().trim();
			 if(val==""){
				 alert('need input loginName');
				 return;
			 }
			 $.get("user/register?loginName="+$("#loginName").val()+"&password="+$("#password").val(), function(result){
				  alert("Register successful?"+result.errCode+","+result.errMsg) 
				});
			/*  $.postJSON("user/register",{loginName:$("#loginName").val(),password:$("#password").val()},
					 function (result) {
	        	 alert("Register successful?"+result.errCode+","+result.errMsg) 
	        }); */
				
			}); 
	</script>
	Get Request:
	<select id="getRequest"> 
	<option value="Register">user/register?loginName=hsia@163.com&password=123456</option>
	<option value="UpdateStudentInfo">user/updateBasic?gender=M&type=</option>
	
	</select>
	
</body>
</html>